﻿<!-- #include file="mymin.asp" -->
<title>帖子编辑</title></head><body><div class='main400'>
<%

dim p,id,a,title,content,rs
' p=getN("p",1)
' if p<1 then p=1

id=getN("id",0)
a=getN("a",0)

if a=0 then
	set rs=Server.CreateObject("ADODB.Recordset")
	rs.open"select title,content from 74hu_topic where id="&id,myconn,1,1
	If Not rs.eof Then
		w "<form method='post' action='editpost.asp'>标题:<input name='title' value='"&nowml(rs("title"))&"' class='input'/><br/>"&_
			"内容:<br/><textarea name='content' cols='45' rows='20'>"&nowml(rs("content"))&"</textarea><br/>"&_
			"<input type='hidden' name='sid' value='"&sid&"'/>"&_
			"<input type='hidden' name='id' value='"&id&"'/>"&_
			"<input type='hidden' name='a' value='1'/>"&_
			"<input type='submit' value='保存帖子'/></form>"
	Else
		w "暂时没有帖子！<br/>"
	end if
	rs.close
	set rs=nothing
else
	title=getD("title","")
	content=getD("content","")
	if title="" or content="" then call Error2("帖子标题或内容不能为空!")
	set rs=Server.CreateObject("ADODB.Recordset")
	rs.open"select title,content,edittime from 74hu_topic where id="&id,myconn,1,3
	If Not rs.eof Then
		rs("title")=title
		rs("content")=content
		rs("edittime")=time_now
		rs.update
		w "帖子编辑成功!<a href='post.asp?sid="&sid&"&amp;id="&id&"'>查看帖子</a><br/>"
	Else
		w "帖子已被删除！<br/>"
	end if
	rs.close
	set rs=nothing
end if
w "----------<br/><a href=""posts.asp?sid="&sid&""">[全部帖子]</a>"

call bbsLast
%>